VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "globals"
Attribute VB_GlobalNameSpace = True
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'$autodoc
'$$
'[overview]
'[usage]
'$$
Private Const OBJ_DATE = "9-Mar-2011"

Public Enum STATUS_CODE
    S_SUCCESS = 0

    ' /* Win32 callbacks (renamed under V42) */

    S_CALLBACK_R_CLICK = 32             '// Deprecated as of V42, ex. S_NOTIFICATION_CLICKED/S_NOTIFICATION_CANCELLED
    S_CALLBACK_TIMED_OUT
    S_CALLBACK_INVOKED                  '// left clicked and no default callback assigned
    S_CALLBACK_MENU_SELECTED            '// HIWORD(wParam) contains 1-based menu item index
    S_CALLBACK_M_CLICK                  '// Deprecated as of V42
    S_CALLBACK_CLOSED                   '//

    ' /* critical errors */

    S_ERROR_FAILED = 101                '// miscellaneous failure
    S_ERROR_UNKNOWN_COMMAND             '// specified command not recognised
    S_ERROR_TIMED_OUT                   '// Snarl took too long to respond
    '//104
    '//105
    S_ERROR_BAD_SOCKET = 106            '// invalid socket (or some other socket-related error)
    S_ERROR_BAD_PACKET = 107            '// badly formed request
    '//108
    S_ERROR_ARG_MISSING = 109           '// required argument missing
    S_ERROR_SYSTEM                      '// internal system error

    S_ERROR_ACCESS_DENIED = 121         '// libsnarl only

    ' /* warnings */

    S_ERROR_NOT_RUNNING = 201           '// Snarl handling window not found
    S_ERROR_NOT_REGISTERED
    S_ERROR_ALREADY_REGISTERED          '// not used yet; sn41RegisterApp() returns existing token
    S_ERROR_CLASS_ALREADY_EXISTS        '// not used yet
    S_ERROR_CLASS_BLOCKED
    S_ERROR_CLASS_NOT_FOUND
    S_ERROR_NOTIFICATION_NOT_FOUND
    S_ERROR_FLOODING                    '// notification generated by same class within quantum
    S_ERROR_DO_NOT_DISTURB              '// DnD mode is in effect was not logged as missed
    S_ERROR_COULD_NOT_DISPLAY           '// not enough space on-screen to display notification
    S_ERROR_AUTH_FAILURE                '// password mismatch

    ' /* informational */

'    S_WAS_MERGED = 251                  '// notification was merged, returned token is the one we merged with

    ' /* callbacks */

'    S_NOTIFY_GONE = 301                 '// reserved for future use

    ' /* the following are currently specific to SNP 2.0 and are effectively the
    '    Win32 S_CALLBACK_nnn constants with 270 added to them */

'    S_NOTIFY_CLICK = 302              '// indicates notification was right-clicked (deprecated as of V42)
    S_NOTIFY_EXPIRED = 303
    S_NOTIFY_INVOKED = 304              '// note this was "ACK" in a previous life
'    S_NOTIFY_MENU_SELECTED            '// indicates an item was selected from user-defined menu (deprecated as of V42)
'    S_NOTIFY_EX_CLICK                 '// user clicked the middle mouse button (deprecated as of V42)
'    S_NOTIFY_CLOSED                   '// user clicked the notification's close gadget

    ' /* the following is generic to SNP and the Win32 API */

    S_NOTIFY_ACTION = 308               '// user picked an action from the list, the data value will indicate which one

End Enum



'Public Function get_setting(ByVal Name As String, ByRef Value As String) As B_STATUS
'Dim pFile As ConfigFile
'
'    If (gSnarlConfigFile Is Nothing) Then
'
'        ' /* get the config */
'
'        Set pFile = uGetSnarlConfigFile()
'        If (pFile Is Nothing) Then
'            get_setting = B_ERROR
'            g_Debug "get_setting(): error getting config file", LEMON_LEVEL_CRITICAL
'            Exit Function
'
'        End If
'
'        Set gSnarlConfigFile = pFile
'
'    End If
'
'    ' /* refresh it */
'
'    If Not gSnarlConfigFile.Load() Then
'        get_setting = B_ERROR
'        Exit Function
'
'    End If
'
'    ' /* find the [general] section */
'
'Dim sz As String
'Dim i As Long
'
'    With gSnarlConfigFile
'        i = .FindSection("snarl")
'        If i <> 0 Then
'            With .SectionAt(i)
'                If .Find(Name, sz) Then
'                    Value = sz
'                    get_setting = B_OK
'
'                Else
'                    g_Debug "get_setting(): '" & Name & "' not found", LEMON_LEVEL_CRITICAL
'                    get_setting = B_ENTRY_NOT_FOUND
'
'                End If
'            End With
'
'        Else
'            g_Debug "get_setting(): [general] section not found", LEMON_LEVEL_CRITICAL
'            get_setting = B_NOT_FOUND
'
'        End If
'
'    End With
'
'End Function
'
'Private Function uGetSnarlConfigFile() As ConfigFile
'Dim pFile As storage_kit.Node
'Dim sz As String
'
'    If Not g_GetSystemFolder(CSIDL_APPDATA, sz) Then _
'        Exit Function
'
'    sz = g_MakePath(sz) & "full phat\snarl\etc\.snarl"
'
'    Set pFile = New storage_kit.Node
'    If Not pFile.SetTo(sz) Then _
'        Exit Function
'
'    If pFile.IsFolder Then _
'        Exit Function
'
'    Set uGetSnarlConfigFile = New ConfigFile
'    uGetSnarlConfigFile.File = pFile.File
'
'End Function
'
'Public Function new_SCallback(Optional ByVal PulseRate As Long = 0) As SCallback
'
'    Set new_SCallback = New SCallback
'    With new_SCallback
'        .SetPulseRate PulseRate
'
'    End With
'
'End Function

Public Function is_snarl_running() As Boolean

    is_snarl_running = snIsSnarlRunning()

End Function

Public Function snarl_version() As Long

    snarl_version = snDoRequest("version")

End Function

'Public Function snarl_revision() As Long
'
'    snarl_revision = sn41getrevision()
'
'End Function

Public Function get_etc_path() As String
Dim sz As String

    If snGetConfigPath(sz) Then _
        get_etc_path = sz

End Function

Public Function make_path(ByVal Path As String) As String

    make_path = g_MakePath(Path)

End Function


